package top.dudu.entity;

import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 商品
 * @author 嘟嘟
 * @date 2020-7-17 , 0017 8:38
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Data
public class ProductInfo {

    @Id
    private String productId;

    private String productName;

    private BigDecimal productPrice;

    private Integer productStock;

    private String productDescription;

    private String productIcon;

    private Integer productStatus;

    private Integer categoryType;

    private Date createTime;

    private Date updateTime;

    // productDescription 和 productIcon 可为null，故此处的构造器里没有这两个字段
    // productStatus有默认值 0（在架）
    public ProductInfo(String productId, String productName, BigDecimal productPrice, Integer productStock, Integer categoryType) {
        this.productId = productId;
        this.productName = productName;
        this.productPrice = productPrice;
        this.productStock = productStock;
        this.categoryType = categoryType;
    }

    public ProductInfo() {
    }
}
